package nc.ui.cmp.iufo;

import java.util.StringTokenizer;
import java.util.Vector;

public class ParamSepTool {

	public static Vector getSepParams(String strParam)
	{
		
		StringTokenizer st=new StringTokenizer(strParam,"\n");
		Vector vRetValues = new Vector();
	
		Vector v0 = new Vector();
		Vector v1 = new Vector();
		
		
		Vector vparams=new Vector();
		while (st.hasMoreTokens())
		{
			vparams.addElement(st.nextToken());
			
		}
		if(vparams.size()>0)
		{
			for (int i = 0; i < vparams.size(); i++) {
				 v0.addElement(getFunname(vparams.elementAt(i).toString()));
				 v1.addElement(getParam(vparams.elementAt(i).toString()));
			}
 		}
		vRetValues.addElement(v0);
		vRetValues.addElement(v1);
		return vRetValues;
	}
	
	public static String getFunname(String fun)
	{
		if(fun!=null && fun.trim().length()>0)
		{
		return  fun.substring(0,fun.indexOf("("));
		}
		return null;
	}
	public static String getParam(String fun)
	{
		if(fun!=null && fun.trim().length()>0)
		{
			return fun.substring(fun.indexOf("(")+1,fun.length()-1);
		}
	return null;	

	}
}
